using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace PP.UserControls
{
    public partial class PanelViewPhoto : UserControl
    {

        private PictureBox m_PicturePreview;
        public PictureBox PicturePreview
        {
            get { return m_PicturePreview; }
            set { m_PicturePreview = value; }
        }

        public PanelViewPhoto()
        {
            this.Enabled = false;
            this.Width = 0;
            this.Height = 0;
            InitializeComponent();
            this.Visible = false;

        }

        public void ShowPhoto()
        {
            this.PanelView.Controls.Clear();
            this.Visible = true;
            this.Enabled = true;
            this.PanelView.Visible = true;

            PicturePreview.Enabled = false;
            PictureBox PictureToView = new PictureBox();
            PictureToView.Width = PicturePreview.Image.Width;
            PictureToView.Height = PicturePreview.Image.Height;
            PictureToView.Image = PicturePreview.Image;
            PictureToView.Click += new EventHandler(PictureToView_Click);

            this.PanelView.Width = PicturePreview.Image.Width;
            this.PanelView.Height = PicturePreview.Image.Height;
            this.PanelView.Controls.Add(PictureToView);

            this.Width = PicturePreview.Image.Width;
            this.Height = PicturePreview.Image.Height;
        }

        void PictureToView_Click(object sender, EventArgs e)
        {
            this.Visible = false;
        }
    }
}
